
package com.esm.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.esm.model.User;
import com.esm.service.AlterSelfInfoService;
import com.esm.serviceimpl.AlterSelfInfoServiceImpl;
import com.esm.utils.JDBCUtil;

import net.sf.json.JSONObject;
/**
 * 
 * @author zyj
 *
 */
public class AlterSelfInfoController extends HttpServlet{
	AlterSelfInfoService as=new AlterSelfInfoServiceImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String uidcard=req.getParameter("uidcard");
		String uname=req.getParameter("uname");
		String usex=req.getParameter("usex");
		String uage=req.getParameter("uage");
		String utelphone=req.getParameter("utelphone");
		HttpSession session=req.getSession();
		User curUser=(User) session.getAttribute("currentUser");
		int uid=curUser.getUid();
		boolean flag=as.alterSelfInfo(uname, usex, uage, utelphone, uidcard, uid);
		if(flag){
			req.getRequestDispatcher("path/alterSuccess.jsp").forward(req, resp);
		}
	}
}
